# !/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 3/19/21 6:04 PM
# @Author : minvan
# @Email : jiangming8937@icloud.com
# @File : SuperPartner.py
# @Software: PyCharm

import execjs
class SuperPartner(object):
    def __init__(self):
        pass


    def GetUuid(self):
        '''
        获取uuid
        :return: uuid
        '''
        js = execjs.compile('''function getuuid() {
          let d = new Date().getTime() + Math.random() * 1000;
          let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(
            /[xy]/g,
            function (c) {
              let r = (d + Math.random() * 16) % 16 | 0;
              d = Math.floor(d / 16);
              return (c == 'x' ? r : (r & 0x3) | 0x8).toString(16);
            }
          );

          return uuid;
        };'''
                            )
        result = js.call('getuuid')
        print(result)
        return result

    def AddDriver(self):
        pass

    def DeletDriver(self):
        pass

if __name__ == '__main__':
    # pass
    SuperPartner().GetUuid()